Skip to content

[Blazor] Disable preloading for enhanced navigation - #63544

Merged
maraf merged 2 commits into
mainfrom
maraf/BlazorPreloadEnhancedNavigation2
Sep 4, 2025
Merged

maraf merged 2 commits into
mainfrom
maraf/BlazorPreloadEnhancedNavigation2

Conversation

@maraf

@maraf maraf commented Sep 4, 2025 •

Copy link
Copy Markdown
Member

Enhanced navigation presents several challenges for preloading

  • DOM merging: Preloading elements may be different between pages which may result in different order, resulting in removing and adding elements, resulting in browser triggering more preload requests than necessary.
  • WebAssembly runtime state: When navigating between pages, WebAssembly is not restarting, only for the first page we need a preloading element.

This PR disables generating preloading elements from ResourcePreloader when the HTTP request is for enhanced navigation.
It alsore removes previous attempt to solve the DOM merging problem from #63239

@maraf maraf added this to the 11.0-preview1 milestone Sep 4, 2025
@maraf maraf self-assigned this Sep 4, 2025
Copilot AI review requested due to automatic review settings September 4, 2025 11:57
@maraf maraf added the area-blazor Includes: Blazor, Razor Components label Sep 4, 2025
@maraf
maraf requested a review from a team as a code owner September 4, 2025 11:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR disables resource preloading for enhanced navigation in Blazor to address issues with DOM merging and unnecessary WebAssembly runtime state initialization. Enhanced navigation doesn't need preloading elements since the WebAssembly runtime persists between page navigations.

  • Removes special handling of preload elements during DOM synchronization
  • Adds enhanced navigation detection to skip WebAssembly asset preloading
  • Changes method visibility to enable reuse across components

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
DomSync.ts Removes preload element detection and special handling during DOM comparison
SSRRenderModeBoundary.cs Adds enhanced navigation check to skip WebAssembly asset preloading
EndpointHtmlRenderer.Streaming.cs Changes IsProgressivelyEnhancedNavigation method from private to internal

@javiercn

javiercn commented Sep 4, 2025

Copy link
Copy Markdown
Member

/backport to release/10.0

/cc: @maraf I imagine we want this in 10.0

@github-actions

github-actions Bot commented Sep 4, 2025

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants